@extends('admin.header')
@section('title','修改管理员界面')
@section('content')
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="col-md-12" id="content">
    <div class="app_content_div" id="app_content_div_301Index">
        <h3>修改密码</h3>
    </div>
    <form name="myform" method="post" action="user/edit-user/{{$user->id}}" >
        @csrf
        <div class="dl_two"><label>输入新密码：</label><input type="password" name="password" id="password" value=""></div><br>
        <div class="dl_two"><label>确认密码：</label><input type="password" name="password_confirmation" id="password_confirmation" value=""></div><br>
        <div class="dl_btn">
            <input  type="button" value="确定" name="submit" class="btn_p" onclick="check()">
        </div>
    </form>
    <script>
        function check(){
            var password=$("#password").val();
            var password_confirmation=$("#password_confirmation").val();
            var _token="{{csrf_token()}}";
            $.post('/user/edit-user/{{$user->id}}',
                {'password':password,'password_confirmation':password_confirmation,'_token':_token},
                function (data){
                    if(data.success){
                        alert("密码修改成功");
                        location.href='/user/editusersuccess';
                    }
                    else{
                        alert(data.msg);
                    }
                },'json');
        }
    </script>
        </div>
    </div>
@endsection
